﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Diagnostics;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.ModelConfiguration;
using System.Reflection;
using System.ComponentModel.DataAnnotations;

namespace BugTracker.Models
{
    public class User
    {
        [Key]
        public int user_idPK { get; set; }

        [Column]
        public int role_idFK { get; set; }

        [Column]
        [Required(ErrorMessage = "Username is Empty")]
        [RegularExpression("^[a-zA-Z0-9]+(([_][a-zA-Z0-9])?[a-zA-Z0-9]*)*$", ErrorMessage = "White space and Special Characters are not Allowed ")]
        public string user_name { get; set; }

        [Column]
        [Required(ErrorMessage = "Password is Empty")]
        [RegularExpression("^([a-zA-Z0-9 .&'-]+)$", ErrorMessage = "Special Characters are not Allowed")]
        [DataType(DataType.Password)]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "Minimum of 6 and Maximum of 20 Characters for Password")]
        public string password { get; set; }

        [Column]
        public string first_name { get; set; }

        [Column]
        public string last_name { get; set; }

        [Column]
        public string datecreated { get; set; }

    }

    public class UserRole
    {
        [Key]
        public int user_idPK { get; set; }

        [Column]
        public int role_idFK { get; set; }

        [Column]
        [Required(ErrorMessage = "Username is Empty")]
        [RegularExpression("^([a-zA-Z0-9 .&'-]+)$", ErrorMessage = "Special Characters are not Allowed")]
        public string user_name { get; set; }

        [Column]
        [Required(ErrorMessage = "Password is Empty")]
        [RegularExpression("^([a-zA-Z0-9 .&'-]+)$", ErrorMessage = "Special Characters are not Allowed")]
        [DataType(DataType.Password)]
        [StringLength(20, MinimumLength = 6, ErrorMessage = "Minimum of 6 and Maximum of 20 Characters for Password")]
        public string password { get; set; }

        [Column]
        public string first_name { get; set; }

        [Column]
        public string last_name { get; set; }

        [Column]
        public string datecreated { get; set; }
        public string role_name { get; set; }
    }
}